package xkp.lesson5.newwork;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

public class Client {
    public static void main(String[] args) throws IOException {

        SocketChannel socketChannel = SocketChannel.open();
        socketChannel.connect(new InetSocketAddress("127.0.0.1",9999));
        String sendStr = "hello";
        ByteBuffer buffer = ByteBuffer.allocate(1024);
        buffer.put(sendStr.getBytes());
        buffer.flip();
        socketChannel.write(buffer);
        socketChannel.close();
    }
}
//netty网络编程框架  在分布式系统中很多框架和很多高级通信框架都是基于netty
//阿里巴巴面试和目前很多大公司面试时经常会问netty框架内容
//对于新手有一定门槛
//NIO起步
